<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<%@page import="com.project.XXXX.stringmodel.PtJobForShownWithBlobs"%>
<%@page import="com.project.XXXX.model.tbl_employerinfo"%>
<html>

<head>
<%@ include file="../commoms/link.txt"%>
<meta name="description" content="JobList">
<style>
.place{
cursor:pointer;
}
</style>
</head>

<body>
	<%@ include file="../commoms/Header.txt"%>

	<%!PtJobForShownWithBlobs ptjob = null;
	tbl_employerinfo ERInfo = null;%>
	<%
		ptjob = (PtJobForShownWithBlobs) request.getAttribute("ptjobInfo");
		ERInfo = (tbl_employerinfo) request.getAttribute("ERInfo");
		if (ptjob == null) {
			request.getRequestDispatcher("Job.jsp").forward(request, response);

		} else {
	%>

	<div class="am-g">
		<div id="Jobinfo" class="am-u-lg-6 am-u-lg-offset-1">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd">
					<h2 class="am-panel-title"><%=ptjob.getTitle()%></h2>



					<span class="am-badge am-badge-secondary"><%=ptjob.getCityid()%></span>
					<span class="am-badge am-badge-success"><%=ptjob.getGenderneedid()%></span>
					<span class="am-badge am-badge-warning"><%=ptjob.getPersonnum()%>人</span>
					<span class="am-badge am-badge-danger"><%=ptjob.getPttypeid()%></span>


				</div>

				<div class="am-panel-bd">
					<div>
						<P>
							<Strong>工作时间：</Strong>
						</P>
						<p><%=ptjob.getBegindate()%>~<%=ptjob.getEnddate()%>
						<p><%=ptjob.getTimebegin()%>~<%=ptjob.getTimeend()%></p>
				
					<p><%=ptjob.confirmed %>/<%=ptjob.getPersonnum()%>人</p>
					
					</div>
				</div>

				<div class="am-panel-footer"></div>
			</div>



			<div class="am-panel am-panel-default">
				<div class="am-panel-hd">
					<h2 class="am-panel-title ">职位详情</h2>


				</div>

				<div class="am-panel-bd" id="jobinfo">
					<div>
						<h3>
							<strong>薪资待遇</strong>
						</h3>
						<p class="am-kai"><%=ptjob.getBillcycleid()%>
							薪资:<%=ptjob.getSalary()%>元 /<%=ptjob.getSalaryunit()%>
						</p>
						<hr>
						<h3>
							<strong>工作内容</strong>
						</h3>
						<p class="am-kai"><%=ptjob.getContect()%></p>
						<hr>
						<h3>
							<strong>工作要求</strong>
						</h3>
						<p class="am-kai"><%=ptjob.getRequirement()%></p>
						<hr>
						<h3>
							<strong>工作地点</strong>
						</h3>
						<%
							String[] temp = ptjob.getPlaces().split("%");
								for(int i=0;i<temp.length;i++)
								{
						%>
						<p class="am-kai"><a class="place" id="place<%=i%>"><%=temp[i]%></a></p>
                         <%} %>
						<button type="button" id="jobsubmit" class="am-btn am-btn-warning"
							style="margin-top: 20px;">我要报名</button>


					</div>

				</div>


			</div>
		</div>
		<%
			if (ERInfo != null) {
		%>
		<div id="ERinfo" class="am-u-lg-5 am-u-end ">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd">
					<h2 class="am-panel-title ">
						<strong>公司介绍</strong>
					</h2>


				</div>

				<div class="am-panel-bd">
					<div>
						<h3>
							<strong>公司名称</strong>
						</h3>
						<p class="am-kai"><%=ERInfo.getName()%></p>
						<hr>
						<h3>
							<strong>公司简介</strong>
						</h3>
						<p class="am-kai"><%=ERInfo.getComment()%></p>

					</div>

				</div>

				<div class="am-panel-footer"></div>
			</div>


			<div class="am-panel am-panel-default " style="height: 450px">
				<div class="am-panel-hd"  style="height: 50px">
					<h2 class="am-panel-title ">
						<strong>工作地点</strong>
					</h2>
				</div>

				<div class="am-panel-bd">
					
						<div id="container" style="height: 340px; border: 1px solid gray"
							></div>
			

				</div>

			</div>


		</div>
		<%
			}
		%>
	</div>
	<%@ include file="../commoms/alert.txt"%>
	<%@ include file="../commoms/comfirmModel.txt"%>
	<script type="text/javascript">
		

		var marker = null;
		var myGeo = new BMap.Geocoder();
		var map = new BMap.Map("container"); // 创建地图实例
		var point = new BMap.Point(116.331398, 39.897445);
		map.centerAndZoom(point, 12);
		map.addControl(new BMap.NavigationControl());
		map.addControl(new BMap.ScaleControl());
		map.addControl(new BMap.OverviewMapControl());
		map.addControl(new BMap.MapTypeControl());

		if (marker != null) {
			map.clearOverlays();
			marker = null;
			infoWindow = null;
		}
	
		   var tempvar="<%=ptjob.getPlaces()%>";
		   var places=tempvar.split('%');
			var place=places[0].split('&');
			setPlace(place[1]);
	
	
		$('#jobinfo').on("click",".place",function(event){
			var index=event.currentTarget.id.replace("place","")
			var place=places[index].split('&');
			setPlace(place[1]);
		});
	
  
		var $confirm = myConfirm('我要报名', '你，确定要投递吗？', function() {

			myAjax(domain + '/commitJobRequest.do', {
				'ptjobid' :
	<%=ptjob.getId()%>
		}, function(data) {
				if (data.state == 'success')
					myAlert('提示', '报名成功!!!');
				else
					myAlert('提示', data.hint);

			})
		}, function() {

		});
		$('#jobsubmit').on('click', function() {
			$confirm.modal('open');

		});

		$('#btnOK').click(function() {
			window.location.href = "Login.jsp";
		});

		function addmarkerf(point) {

			if (marker != null) {
				map.clearOverlays();
				marker = null;
			}
			marker = new BMap.Marker(point); // 创建标注
			map.addOverlay(marker);
			
			getGeoAddress(point);
		}
		function setPlace(myValue) {
			map.clearOverlays(); //清除地图上所有覆盖物
			function myFun() {
				var pp = local.getResults().getPoi(0).point;
				addmarkerf(pp);
				map.centerAndZoom(pp, 18);
			}
			var local = new BMap.LocalSearch(map, {
				onSearchComplete : myFun
			});

			local.search(myValue);
		}
		function getGeoAddress(point) {
			myGeo.getLocation(point,
					function(result) {
						if (result) {
							geoaddress = result.address;
							lat = point.lat;
							lng = point.lng;
							infoWindow = new BMap.InfoWindow(geoaddress, opts); // 创建信息窗口对象
							map.openInfoWindow(infoWindow,point);
						}
					});

		}
		var opts = {
				width : 250, // 信息窗口宽度
				height : 100, // 信息窗口高度
				title : "地址" // 信息窗口标题
			}
		$('#changecity').text(localCity);
	</script>
	<%
		}
	%>

</body>



</html>
